<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib uri="/WEB-INF/tld/ce.tld" prefix="ce" %>
<%
String path = request.getContextPath();
String editActionName = path+request.getAttribute("REQUEST_PATH")+"?op=savejs";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <script language="javascript" src="<%=path %>/jslib/orgSelect.js"></script>
    <title>受托协查台账编辑</title>
<script type="text/javascript">
<!--
           $(function(){
             
               $('#assitTypeNum').validatebox({
                   required:'true',
                   missingMessage:'请选择协查类型'
               });
               //$('#entrustDeptId').combotree({
   			 //   url:'<%=path%>/util/util_searchOrgJsonTree.action?&',
   			 //   params:{},
   			 //   valueField:'id',
   		     //   textField:'text',
   		      //  required:true, //要求必填
            //    missingMessage:'请选择委托部门',
   		     //   panelWidth:200,
   		     //   checkbox:false
   		    //    });
	           //点击添加按钮操作
			   $('#addBtn').click(function(){
				  $('#assitTypeName').val($('#assitTypeNum option:selected').text());
				  $('#assitItem').val($('#assitItemId option:selected').text());
				  
                  $('#editForm').submit();
	            });
	            //表单验证及提交处理操作
	           $('#editForm').form({
			        url:'<%=editActionName%>',
			        onSubmit: function(){
			           if($(this).form('validate')){
			                 $.util.showLoading();
			                 $('#operateWindow').window('close');
                            return true;
			             }else{
			                return false;
			             }
			        },
			        success:function(data){
			            $.util.removeLoading();
                        returnOptMsg(data);
			        }
				});
	            
	            
	           $('#inspectionDeptId').combobox({
           		url:'<%=path %>/util/util_getInspectionList.action?id=15009070000',
           		valueField:'id',
           		textField:'text',
           		editable:false,
           		onChange: function(n,o){
           			var url = '<%=path %>/util/util_getInspectionList.action?id='+n;
           			$('#collectionDeptId').combobox('reload', url);
           		}
           	});
              
              $('#collectionDeptId').combobox({
            		url:'<%=path %>/util/util_getInspectionList.action?id='+$('#inspectionDeptId').val(),
            		valueField:'id',
            		textField:'text',
            		editable:false
            	});
              if($('#inspectionDeptId').val()){
           	   $('#inspectionDeptId').combobox('setValue',$('#inspectionDeptId').val());
           	   $('#inspectionDeptId').change();
              }
              if($('#collectionDeptId').val()){
           	   $('#collectionDeptId').combobox('setValue',$('#collectionDeptId').val());
              }
              
              $('#taxpayerNumber').change(function(){
					if($('#taxpayerNumber').val()){
						$.post("<%=path%>/cases/source/CaseSource_getNsrinfoByTaxpayerNumber.action?taxpayerNumber="+$('#taxpayerNumber').val(),function(data)
								{
							 		jsonReStr = jQuery.parseJSON(data);
							 		if(jsonReStr.opState=="failure"){  //操作失败处理
							 			$('#inspectionDeptId').combobox('setValue','');
							 			$('#collectionDeptId').combobox('setValue','');
							 			$('#involvedEnterprice').val('');
							 			$('#inspectionDept').val('');
							 			$('#collectionDept').val('');
						                $.messager.alert('消息提示','操作处理失败！原因如下：<br><font color=red>'+jsonReStr.opInfo+'</font>','error');
						               // $('#taxpayerNumber').val('');
							 			//return ;
						            }else{
						            	$('#inspectionDeptId').combobox('setValue',jsonReStr.jcjdm);
						            	$('#inspectionDept').val(jsonReStr.jcjmc);
						            	
						            	$('#involvedEnterprice').val(jsonReStr.nsrmc);
						            	$('#caseNumber').val(jsonReStr.statusInfo);
						            	//$('#inspectionDeptId').change();
						            	$('#collectionDeptId').combobox('setValue',jsonReStr.zgswjDm);
						            	$('#collectionDept').val(jsonReStr.zgswjMc);
						            }
							 		
							 	}
							 	);	
					}
					
            	});
	            
	            
	            
	            
	            
           });
//-->
</script>
  </head>
  <body>
<s:form action="editForm" method="post">
    <s:hidden name="po.vcId"/>
    <s:hidden id="assitTypeName" name="po.assitTypeName"/>
    <s:hidden id="assitItem" name="po.assitItem"/>    
    <s:hidden id="inspectionDept" name="po.inspectionDept"/>
    <s:hidden id="collectionDept" name="po.collectionDept"/>
	<table align="center" width="100%"  class="tb_add_th">
	<tr><th>协查类型:</th><td>
	    <ce:dictSelect id="assitTypeNum" name="po.assitTypeNum" dictName="协查管理-协查类型" blankOption="true" style="width:120px;"/>
	</td>
	    <th>委托单位:</th><td><s:textfield id="entrustDept"  name="po.entrustDept" style="width:120px;"/></td>
	</tr>
	<tr><th>函号:</th><td><s:textfield id="entrustCode"  name="po.entrustCode" style="width:120px;"/></td>
	    <th>是否是市内协查:</th><td><s:radio list="#{1:'是',0:'否'}" name="po.isCity" /></td>	</tr>
	
	<tr><th>纳税人识别号:</th><td colspan="3"><s:textfield id="taxpayerNumber"  name="po.taxpayerNumber" style="width:240px;"/></td></tr>
	
	<tr><th>管辖稽查局:</th><td><s:textfield id="inspectionDeptId"  name="po.inspectionDeptId" style="width:120px;"/></td>
	    <th>所属征管局:</th><td><s:textfield id="collectionDeptId"  name="po.collectionDeptId" style="width:120px;"/></td>
	</tr>
	<tr><th>涉案企业:</th><td colspan="3"><s:textfield id="involvedEnterprice"  name="po.involvedEnterprice" style="width:240px;"/></td></tr>
	<tr><th>发票份数:</th><td><s:textfield id="billCount"  name="po.billCount" style="width:120px;"/></td>
	    <th>协查事项:</th><td><ce:dictSelect id="assitItemId" name="po.assitItemId" dictName="协查管理-协查事项" blankOption="true" style="width:120px;"/></td>
	</tr>
	<tr></tr>
	<tr><th>税额:</th><td><s:textfield id="taxMoney"  name="po.taxMoney" label="税额" style="width:120px;"/></td>
		<th>金额:</th><td><s:textfield id="amountMoney"  name="po.amountMoney" style="width:120px;"/></td>
	</tr>	
	
	<tr><th>协查事项:</th><td colspan="3"><ce:dictSelect id="assitItemId" name="po.assitItemId" dictName="协查管理-协查事项" blankOption="true" style="width:120px;"/></td></tr>
	
	<tr>
	   <th>协查原因:</th><td colspan="3"><s:textarea id="assitReason"  name="po.assitReason" label="协查原因"/></td>
	</tr>
	</table>    
</s:form>
  </body>
</html>

